<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>生态瞬时评估 - 绑定试卷</title>

    <meta name="keywords" content="">
    <meta name="description" content="">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="../favicon.ico">
    <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="../css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">
    <link href="../css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <h3 class="col-sm-offset-3 col-sm-6 text-center">添加试卷</h3>
    </div>
    <div class="row">
        <div class="col-sm-offset-3 col-sm-6">
            <form class="form-horizontal" style="margin-top: 20px">
                <div class="form-group">
                    <div class="col-sm-8">
                        <input type="text" placeholder="请输入试卷名称" class="form-control" id="examination-name" >
                    </div>
                    <div class="col-sm-3">
                        <button class="btn btn-primary btn-block" id="addBtn">确定</button>
                    </div>
                </div>




            </form>
        </div>
    </div>

</div>




<script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/bootstrap.min.js?v=3.3.6"></script>
<script>
    $(document).ready(function () {
        $("#addBtn").click(function (e) {
            e.preventDefault();
            var examName = $("#examination-name").val();
            var token = sessionStorage.getItem("token");
            $.ajax({
                type:"POST",
                url:"http://123.206.18.189:8080/paper",
                data:{paperName:examName},
                headers:{
                    authToken:token
                },
                success:function(){

                },
                complete:function (xhr) {
                    if(xhr.status==200&xhr.readyState==4){
                        alert("试卷添加成功！");
                        window.history.back();
                    }
                },
                error:function () {

                }
            })
        })
    })
</script>
</body>
</html>